package easyzhou.com.ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class MainFrame extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = -731692075274966906L;
	private final int width = 1024;
	private final int heigth = 800;
	private CenterPanel centerPanel;
	private NorthPanel northPanel;
	private SouthPanel southPanel;
	private EastPanel eastPanel;

	private MainFrame() {
		init();
	}

	private void init() {
		centerPanel = CenterPanel.newInstance(this);
		northPanel = NorthPanel.newInstance(this);

		Container contentPane = getContentPane();

		setBackground(Color.CYAN); // 将JFrame实例背景设置为蓝绿色
		setLayout(new BorderLayout());
		contentPane.add(northPanel, BorderLayout.NORTH);
		contentPane.add(centerPanel, BorderLayout.CENTER);
		// contentPane.add(southPanel, BorderLayout.SOUTH);
		// contentPane.add(eastPanel, BorderLayout.EAST);

		setSize(width, heigth);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setLocationRelativeTo(null); // 让窗体居中显示
		setVisible(true);

	}

	public CenterPanel getCenterPanel() {
		return centerPanel;
	}

	public void setCenterPanel(CenterPanel centerPanel) {
		this.centerPanel = centerPanel;
	}

	public NorthPanel getNorthPanel() {
		return northPanel;
	}

	public void setNorthPanel(NorthPanel northPanel) {
		this.northPanel = northPanel;
	}

	public SouthPanel getSouthPanel() {
		return southPanel;
	}

	public void setSouthPanel(SouthPanel southPanel) {
		this.southPanel = southPanel;
	}

	public EastPanel getEastPanel() {
		return eastPanel;
	}

	public void setEastPanel(EastPanel eastPanel) {
		this.eastPanel = eastPanel;
	}

	public int getWidth() {
		return width;
	}

	public int getHeigth() {
		return heigth;
	}

	public static void main(String[] args) {
		try {
			new MainFrame();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
